<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>逛水果店</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
    }

    #app {
        text-align: center;
        margin: 50px auto;

    }

    table {
        margin: 0 auto
    }

    tbody {
        text-align: center;
    }
</style>

<body>
    <div id="app">
        <h4>欢迎光临_vue开发的收银系统_水果店</h4>
        <table border="1" width="600" height="100">
            <caption>
                苹果10￥/斤，折扣/《8 折》
            </caption>
            <tbody>
                <tr>
                    <td>
                        <span>请输入你要购买的斤数</span>
                        <input v-model.number.trim="count" type="number" placeholder="请输入斤数" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <button @click="totalMoeny">结账买单</button>
                    </td>
                </tr>
                <tr>
                    <td>
                        结账单：总价:{{ total }}￥元 折后价:{{ total * 0.8 }}￥元 省了:{{ total * 0.2 }}￥元
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <script src="../vue.js"></script>
    <script>
        new Vue({
            el: "#app",
            data: {
                count: '',
                total: 0
            },
            methods: {
                totalMoeny() {
                    this.total = parseInt(this.count * 10)
                }
            }
        })
    </script>
</body>

</html>